package code

import (
	"wxsdk/miniapp/core"
)

// 设置卡券失效接口.
func Unavailable(authorizerAccessToken string, id *CardItemIdentifier) (err error) {
	var result core.Error
	incompleteURL := "https://api.weixin.qq.com/card/code/unavailable?access_token="
	serverUrl := incompleteURL + authorizerAccessToken
	client := core.GetPostJSONClient()
	if _, err = client.Excute("POST", serverUrl, id, &result); err != nil {
		return
	}
	if result.ErrCode != core.ErrCodeOK {
		err = &result
		return
	}
	return
}
